package cn.gson.crm.control.allot;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.StaffPoDao;
import cn.gson.crm.model.po.StaffPo;

/**
 * 
 * */

@WebServlet("/allot/manager")
public class AllotManagerServlet extends BaseServlet{
private StaffPoDao staffPoDao = new StaffPoDao(); 
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String nowpage = request.getParameter("anowpage");
		String allotName = request.getParameter("allotName");
		int page = staffPoDao.getStaffPageSum(allotName);
		request.getSession().setAttribute("apageSum", page);
		if(nowpage == null){
		nowpage = "1";
		}
		request.getSession().setAttribute("anowpage", nowpage);
		List<StaffPo> staffPoList = staffPoDao.getStaffPoListByType(Integer.parseInt(nowpage),allotName);
		request.setAttribute("staffPoList", staffPoList);
		request.setAttribute("queryString", noPageQueryString());
		forward("allot/allot_manager.jsp");
	}

}
